Skip to content

Conversation

compiler-errors
Copy link
Member

we previously suppressed coercion errors when the return type was dyn Trait because we expect a far more descriptive Sized trait error to be emitted instead, however the code that does this suppression does not consider where-clause predicates since it just looked at the HIR. let's do that instead by creating an obligation and checking if it may hold.

fixes #110683
fixes #112208

@rustbot
Copy link
Collaborator

rustbot commented Jun 2, 2023

r? @cjgillot

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 2, 2023
@matthiaskrgr
Copy link
Member

can be made ice on stable as well
#112208 (comment)

is it worth beta-nominating this?

@compiler-errors
Copy link
Member Author

is it worth beta-nominating this?

@matthiaskrgr: i don't know how wide-spread it is, tbh. you kinda have to write weird code to get it to trigger (where dyn Trait<...>: Sized, where ... references a generic parameter), so i'd say no but could be convinced otherwise.

@cjgillot
Copy link
Contributor

cjgillot commented Jun 3, 2023

I agree. This can only happen because of trivially false bounds that users are unlikely to write. The only reports are those from your fuzzing.
@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 3, 2023

📌 Commit 9f70efb has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 3, 2023
…, r=cjgillot

only suppress coercion error if type is definitely unsized

we previously suppressed coercion errors when the return type was `dyn Trait` because we expect a far more descriptive `Sized` trait error to be emitted instead, however the code that does this suppression does not consider where-clause predicates since it just looked at the HIR. let's do that instead by creating an obligation and checking if it may hold.

fixes rust-lang#110683
fixes rust-lang#112208
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 3, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#111659 (suggest `Option::as_deref(_mut)` on type mismatch in option combinator if it passes typeck)
 - rust-lang#111702 (Option::map_or_else: Show an example of integrating with Result)
 - rust-lang#111878 (Fix codegen test suite for bare-metal-like targets)
 - rust-lang#111969 (bootstrap: Make `clean` respect `dry-run`)
 - rust-lang#111998 (Add other workspaces to `linkedProjects` in rust_analyzer_settings)
 - rust-lang#112215 (only suppress coercion error if type is definitely unsized)
 - rust-lang#112231 (Make sure the build.rustc version is either the same or 1 apart (revised))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 20cbbbb into rust-lang:master Jun 3, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 3, 2023
@compiler-errors compiler-errors deleted the check-sized-better branch August 11, 2023 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: coercion error but no error emitted / mismatched types / broken MIR ICE: broken mir
5 participants